import { createRouter, createWebHistory } from 'vue-router'
// import Login from '../views/Login.vue'
const Login = () => import("../views/Login.vue")
// import Home from '../views/Home.vue'
const Home = () => import("../views/Home.vue")

// import Device from '../views/Device.vue'
const Device = () => import("../views/Device.vue")

// import DeviceList from '../views/DeviceList.vue'
const DeviceList = () => import("../views/DeviceList.vue")

// import InsectDetection from '../views/InsectDetection.vue'
const InsectDetection = () => import("../views/InsectDetection.vue")

// import EnvironmentalMonitor from '../views/EnvironmentalMonitor.vue'
const EnvironmentalMonitor = () => import("../views/EnvironmentalMonitor.vue")

// import Monitor from '../views/Monitor.vue'
const Monitor = () => import("../views/Monitor.vue")

// import Help from '../views/Help.vue'
const Help = () => import("../views/Help.vue")

// import Insectalerts from '../views/insectalerts.vue'
const Insectalerts = () => import("../views/insectalerts.vue")

const Photo = () => import("../views/Photo.vue")
const Photos = () => import("../views/Photos.vue")
const Meteorology = () => import("../views/Meteorology.vue")

// import Test from '../views/Test.vue'
const Test = () => import("../views/Test.vue")


const routes = [
  {
    path: '/device', name: 'device', component: Device, children: [
      { path: '/device', redirect: '/device/insectdetection' },
      { path: '/device/devicelist', name: 'devicelist', component: DeviceList },
      { path: '/device/insectdetection', name: 'insectdetection', component: InsectDetection },
      { path: '/device/environmentalmonitor', name: 'environmentalmonitor', component: EnvironmentalMonitor },
      { path: '/device/monitor', name: 'monitor', component: Monitor },
      { path: '/device/meteorology', name: 'meteorology', component: Meteorology },
      { path: '/device/photo', name: 'photo', component: Photo },
      { path: '/device/photos', name: 'photos', component: Photos },
    ]
  },
  { path: '/', redirect: "/login" },
  { path: '/login', name: 'login', component: Login },
  { path: '/home', name: 'home', component: Home },
  
  { path: '/help', name: 'help', component: Help },
  { path: '/insectalerts', name: 'insectalerts', component: Insectalerts },
  { path: '/test', name: 'test', component: Test }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
